{{!

  Copyright (c) Meta Platforms, Inc. and affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}{{!

  This template defines a constant value representation for a given value.

  All type values are rendered as "concrete" values, except for structs - which
  are rendered as struct pointers. Callers are responsible for dereferencing
  appropriately if needed.

  The following templates have complete type parity:
    * const/value.mustache
    * common/natural_default_value.mustache
    * common/go_zero_value.mustache

}}
{{#type:typedef?}}{{!
  }}{{#type:typedef_type}}{{!
    }}{{> const/value}}{{!
  }}{{/type:typedef_type}}{{!
}}{{/type:typedef?}}{{!
}}{{^type:typedef?}}{{!
  }}{{#type:byte?}}int8({{value:integer_value}}){{/type:byte?}}{{!
  }}{{#type:i16?}}int16({{value:integer_value}}){{/type:i16?}}{{!
  }}{{#type:i32?}}int32({{value:integer_value}}){{/type:i32?}}{{!
  }}{{#type:i64?}}int64({{value:integer_value}}){{/type:i64?}}{{!
  }}{{#type:string?}}{{value:go_quoted_value}}{{/type:string?}}{{!
  }}{{#type:binary?}}[]byte({{value:go_quoted_value}}){{/type:binary?}}{{!
  }}{{#type:bool?}}{{value:nonzero?}}{{/type:bool?}}{{!
  }}{{#type:float?}}{{!
    }}{{#value:double?}}float32({{value:double_value}}){{/value:double?}}{{!
    }}{{#value:integer?}}float32({{value:integer_value}}.0){{/value:integer?}}{{!
  }}{{/type:float?}}{{!
  }}{{#type:double?}}{{!
    }}{{#value:double?}}float64({{value:double_value}}){{/value:double?}}{{!
    }}{{#value:integer?}}float64({{value:integer_value}}.0){{/value:integer?}}{{!
  }}{{/type:double?}}{{!
  }}{{#type:enum?}}{{!
    }}{{#type:enum}}{{!
      }}{{enum:go_qualified_name}}{{!
    }}{{/type:enum}}{{!
    }}{{#value:enum_value?}}{{!
      }}{{#value:enum_value}}{{!
        Known enum value with a name.
        }}_{{enum_value:name}}{{!
      }}{{/value:enum_value}}{{!
    }}{{/value:enum_value?}}{{!
    }}{{^value:enum_value?}}{{!
      Unknown enum value without a name.
      }}({{value:integer_value}}){{!
    }}{{/value:enum_value?}}{{!
  }}{{/type:enum?}}{{!

  Structs
  }}{{#type:structured?}}{{!
    }}{{#type:structured}}{{!
      }}{{#value:referenceable?}}{{!
        }}{{#value:owning_const}}{{!
          }}{{#constant:program}}{{!
            }}{{constant:go_qualified_name}}{{!
          }}{{/constant:program}}{{!
        }}{{/value:owning_const}}{{!
      }}{{/value:referenceable?}}{{!
      }}{{^value:referenceable?}}{{!
        }}{{> const/struct_value}}{{!
      }}{{/value:referenceable?}}{{!
    }}{{/type:structured}}{{!
  }}{{/type:structured?}}{{!

  Map constants
}}{{#type:map?}}{{!
  }}{{> common/type}}{
{{#value:map_elements}}
    {{#element:key}}{{!
      }}{{#type:key_type}}{{!
        }}{{> const/value}}{{!
      }}{{/type:key_type}}{{!
    }}{{/element:key}}: {{!
    }}{{#element:value}}{{!
      }}{{#type:value_type}}{{!
        }}{{> const/value}}{{!
      }}{{/type:value_type}}{{!
    }}{{/element:value}},
{{/value:map_elements}}
}{{/type:map?}}{{!

  List constants
}}{{#type:list?}}{{!
  }}{{> common/type}}{
{{#value:list_elements}}
    {{#type:list_elem_type}}{{!
      }}{{> const/value}},{{!
    }}{{/type:list_elem_type}}
{{/value:list_elements}}
}{{/type:list?}}{{!

  Set constants
}}{{#type:set?}}{{!
  }}{{> common/type}}{
{{#value:list_elements}}
    {{#type:set_elem_type}}{{!
      }}{{> const/value}},{{!
    }}{{/type:set_elem_type}}
{{/value:list_elements}}
}{{/type:set?}}{{!

}}{{/type:typedef?}}
